home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MISC.SWG / 0118_Detecting Debug 2.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  1KB  |  50 lines

  1. {
  2. >> Possible. Just capture int 01h (as your HelpPC describes:
  3. >> Single Step) and int 03h (as your HelpPC describes: Breakpoint).
  4. >> They will be executed when there will be someone trapping your program
  5. >> by steps. You may place such code in those interrupt procedures:
  6. }
  7.  
  8. Program NoDebug;
  9.  
  10. uses Dos;
  11.  
  12. var
  13.   OldInt01, OldInt03, OldExitProc : pointer;
  14.  
  15. Procedure DebugDetected;
  16. Begin
  17.   WriteLn('Hey! Stop tracing my program!');
  18.   Halt
  19. End; { DebugDetected }
  20.  
  21. Procedure NewInt01; interrupt; assembler;
  22. Asm
  23.   call dword ptr [OldInt01]
  24.   call DebugDetected
  25. End; { NewInt01 }
  26.  
  27. Procedure NewInt03; interrupt; assembler;
  28. Asm
  29.   call dword ptr [OldInt03]
  30.   call DebugDetected
  31. End; { NewInt03 }
  32.  
  33. Procedure NewExitProc; far;
  34. Begin
  35.   ExitProc := OldExitProc;
  36.   SetIntVec($01, OldInt01);
  37.   SetIntVec($03, OldInt03)
  38. End; { NewExitProc }
  39.  
  40. Begin
  41.   GetIntVec($01, OldInt01);
  42.   GetIntVec($03, OldInt03);
  43.   OldExitProc := ExitProc;
  44.   ExitProc := @NewExitProc;
  45.   SetIntVec($01, Addr(NewInt01));
  46.   SetIntVec($03, Addr(NewInt03));
  47.  
  48.   WriteLn('Here your program goes...')
  49. End.
  50.